import { defaultOptions1, defaultOptions2, StudyObjDict } from './data';

/**
 *
 * @param type 1是4种 2是6种.具体的见实际值
 * @returns
 */
function getStudyObjectList(type = 1) {
  if (type === 1) {
    return defaultOptions1;
  } else {
    return defaultOptions2;
  }
}

function getStudyObjectDefaultAll(optionsType = 1) {
  const defaultOptions = optionsType === 1 ? defaultOptions1 : defaultOptions2;
  return defaultOptions.map((v) => v.value).join(',');
}

function getStudyObjectString(arrOrStr?: string | string[]) {
  const arr = typeof arrOrStr === 'string' ? arrOrStr.split(',') : arrOrStr;

  return arr
    ?.map((v) => {
      return StudyObjDict[v];
    })
    .filter((v) => v)
    .join(',');
}

export { getStudyObjectList, getStudyObjectDefaultAll, getStudyObjectString };
